using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WOWEquipOptimizer
{
    /// <summary>
    /// filter m_Items based on ilvl, m_Items etc.
    /// </summary>
    public partial class FilterItemsDialog : Form
    {
        public int MaxItemLevel
        {
            get { return Int32.Parse(FIDILevelAboveBox.Text); }
            set { FIDILevelAboveBox.Text = value.ToString(); }
        }
        public int MinItemLevel
        {
            get { return Int32.Parse(FIDILevelBelowBox.Text); }
            set { FIDILevelBelowBox.Text = value.ToString(); }
        }
        public FilterItemsDialog()
        {
            InitializeComponent();
        }
        public List<string> getDungeonFilter()
        {
            List<string> dungeons = new List<string>();
            foreach (object obj in FIDAreaFilterListBox.SelectedItems)
            {
                dungeons.Add((string)obj);
            }
            return dungeons;
        }
        public List<ItemSource> getSourceFilter()
        {
            List<ItemSource> sources = new List<ItemSource>();
            foreach (object obj in FIDSourceFilterListBox.SelectedItems)
            {
                if (obj.GetType() == typeof(string))
                {
                    sources.Add((ItemSource)Enum.Parse(typeof(ItemSource), (string)obj));
                }
            }
            return sources;
        }
        public void setSources()
        {
            FIDSourceFilterListBox.Items.Clear();
            string[] sources = Enum.GetNames(typeof(ItemSource));
            for(int i = 1;i<sources.Length;i++)
            {
                FIDSourceFilterListBox.Items.Add(sources[i]);
            }
        }
        public void setDungeons(List<string> dungeons)
        {
            FIDAreaFilterListBox.Items.Clear();
            foreach (string dungeon in dungeons)
            {
                FIDAreaFilterListBox.Items.Add(dungeon);
            }
        }
    }
}